package com.leadbank.security.hello.controller;

import com.leadbank.security.hello.model.Employee;
import com.leadbank.security.hello.service.CountryService;
import com.leadbank.security.hello.service.EmployeeManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;


@Controller
public class CountryController {

    @Autowired
    private CountryService countryService;

    @RequestMapping(value = "/country/list", method = RequestMethod.GET)
    public String listEmployees(ModelMap map) {

        map.addAttribute("employee", new Employee());
        map.addAttribute("employeeList", countryService.getCountryList());

        return "editEmployeeList";
    }

    @RequestMapping(value = "/country/delete/{countrycode}", method = RequestMethod.GET)
    public String deleteEmployees(@PathVariable String countrycode) {

        countryService.deleteCountry(countrycode);

        return "editEmployeeList";
    }

}